package ru.susu.algebra.ranks;


/**
 * @author akargapolov
 * @since: 04.05.2011
 */
public class DSquaresRTableConstructor
{
	private static int LAST_ON_FIRST_PAGE = 500;
	private static int LAST_NUMBER = 1000;
	private static int INTERVAL = 10;

	public static void main(String[] args) throws Exception
	{
		printResults();
	}
	
	private static String getLine(int number)
	{
		return new StringBuilder().append("$" + number + "$ & $")	///n
				.append(FullDPRanksCounterNewSquare.recDP(number, 1, 0)) /// d(n)
				.append("$ & $")
				.append(FromSquareFileRanksProvider.squares.get(number))	///squares(n)
				.append("$ & $")
				.append(FromSquareFileRanksProvider.ranks.get(number)).append("$").toString();
	}
	
	private static void printResults()
	{
		for (int number = INTERVAL; number <= LAST_ON_FIRST_PAGE / 2; number+=INTERVAL)
		{
			String oneStr = getLine(number) + " & " + getLine(number + LAST_ON_FIRST_PAGE / 2) + " \\\\";
			System.out.println(oneStr);
		}
		
		/*
		//две колонки - подходит для scriptsize
		int lastFirstColumn = (LAST_NUMBER - LAST_ON_FIRST_PAGE) / 2;
		for (int number = INTERVAL; number <= lastFirstColumn; number+=INTERVAL)
		{
			String oneStr = getLine(number + LAST_ON_FIRST_PAGE) + " & " + getLine(number + LAST_ON_FIRST_PAGE + lastFirstColumn) + " \\\\";
			System.out.println(oneStr);
		}*/
		//одна колонка
		for (int number = LAST_ON_FIRST_PAGE + INTERVAL; number <= LAST_NUMBER; number+=INTERVAL)
		{
			String oneStr = getLine(number) + " \\\\";
			System.out.println(oneStr);
		}
	}

}
